// Author: Puyan Lotfi
// Date: Written in June 2009
// Description: Code for parsing ctags files, and maintaining editor state
//              related to ctags.

#pragma once
#define MAX_LINE_LENGTH 1024

#include <vector>

class Tag
{

public:
    inline Tag()
    {
        Init("", "", "");
    }

    inline Tag(QString tagname, QString filename, QString code)
    {
        Init(tagname, filename, code);
    }

    QString m_tagname;
    QString m_filename;
    QString m_code;

private:
    inline void Init(QString tagname, QString filename, QString code)
    {
        m_tagname = tagname;
        m_filename = filename;
        m_code = code;
    }
};

class CtagsReader
{

public:
    CtagsReader();
    void loadTagsFromFile(QString filename);
    void clearTags();
    Tag getFileAndCodeForTag(QString tag);
    Tag getFileAndCodeForTag(QString tagName, bool fromFront);
    Tag getTagByIndex(size_t i);
    std::vector<Tag> getTagsByQuery(QString query);
    size_t size();

private:
    std::vector<Tag> m_tags;
    QString s_ctagsCodeStart;
    QString s_ctagsCodeEnd;

};
